<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    /* todo
            对象的浅拷贝： let obj1 = xxx; let obj2 = obj1; 指向内存地址中的统一地址
            对象的深拷贝：
    */
    let student01 = {
        id: 1,
        name: '张三',
        age: 18,
    }
    let student02 = student01
    student02.name = '李四'
    console.log(student01)
    console.log(student02)
    let student03 = {
        id: 1,
        name: '王五',
        age: 22,
    }
    // 深拷贝 现将对象转换为字符串 再将字符串转换为对象
    let student04 = JSON.parse(JSON.stringify(student03))
    student04.name = '赵六'
    console.log(student03)
    console.log(student04)
    let Person = function (name, age) {
        this.name = name
        this.age = age
    }
    let person01 = new Person('张三', 23)
    let person02 = person01
    console.log(person01)
    console.log(person02)
    let person03 = JSON.parse(JSON.stringify(person01))
    person03.name = '李四'
    console.log(person01)
    console.log(person03)

</script>

</body>
</html>